home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1997 January / macformat46.iso / File Maker Pro 3.0 Tutorial / File Maker Pro 3.0 / Templates / FileMaker And Apple Events / Sample Applications / Relational Data / Get Related Data next >
Text File  |  1996-06-05  |  1KB  |  38 lines

  1.  
  2. -- one line examples
  3.  
  4. tell application "FileMaker Pro"
  5.     tell database "Master File"
  6.         record 1 -- get entire record including portal
  7.         cell "Related File::Product ID" -- get related cell by name
  8.         cell 2 -- get related cell by number
  9.         cell ID {1, {1, 2}} -- get related cell by ID
  10.         field "Related File::Product ID" -- get related field by name
  11.         field 2 -- get related field by number
  12.         field ID {1, 2} -- get related field by ID
  13.         every field whose name contains "::" -- get all related fields from a layout
  14.     end tell
  15. end tell
  16. getRelationshipsfromFieldNames()
  17.  
  18.  
  19. --this routine returns the name of every relationship based on all related fields on the current layout
  20. --note that you can get the name of the related file is the relationship name is the same as the related file
  21. on getRelationshipsfromFieldNames()
  22.     tell application "FileMaker Pro"
  23.         set relationshipNames to {}
  24.         tell database "Master File"
  25.             --create a list of the names of all related fields
  26.             set relatedFields to name of every field whose name contains "::"
  27.             
  28.             --extract the name of the related file from each related field
  29.             repeat with fieldName in relatedFields
  30.                 set relationshipNames to relationshipNames & (characters 1 thru ((offset of "::" in fieldName) - 1) of fieldName as string)
  31.             end repeat
  32.             
  33.             --return the list of related file names
  34.             return relationshipNames
  35.         end tell
  36.     end tell
  37. end getRelationshipsfromFieldNames
  38.